<%@ page import="com.walkingfiles.registry.Transfer" %>
<%@ page import="com.walkingfiles.registry.Document" %>
<%@ page import="com.walkingfiles.registry.Area" %>


<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'destinationArea', 'error')} required">
	<label for="destinationArea">
		<g:message code="transfer.destinationArea.label" default="Destination" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="destinationArea" name="destinationArea.id" from="${com.walkingfiles.registry.Area.findAllByIdNotEqual(session.currentAreaId)}" optionKey="id" optionValue="name"
required="" value="${transferInstance?.destinationArea?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'subject', 'error')} required">
	<label for="subject">
		<g:message code="transfer.subject.label" default="Subject" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="subject" name="subject.id" from="${com.walkingfiles.registry.TransferSubject.list()}" optionKey="id" optionValue="name"
required="" value="${transferInstance?.subject?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'sendComment.comment', 'error')} ">
	<label for="comment">
		<g:message code="transfer.sendComment.label" default="Comment" />
		
	</label>
	<g:textArea name="sendComment.comment" cols="40" rows="5" value="${transferInstance?.sendComment?.comment}" />
</div>

<%--
<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'transferDocuments', 'error')} ">
	<label for="transferDocuments">
		<g:message code="transfer.transferDocuments.label" default="Transfer Documents" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${transferInstance?.transferDocuments?}" var="t">
    <li><g:link controller="transferDocument" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="transferDocument" action="create" params="['transfer.id': transferInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'transferDocument.label', default: 'TransferDocument')])}</g:link>
</li>
</ul>

</div>
--%>

<div class="fieldcontain ${hasErrors(bean: transferInstance, field: 'transferDocuments', 'error')} required">
	<label for="transferDocuments">
		<g:message code="transfer.documents.label" default="Expedientes" />
				<span class="required-indicator">*</span>
	</label>
	
<ul class="one-to-many">
<g:each in="${Document.findAllByCurrentAreaAndOutboxAndTransferIsNull(Area.get(session.currentAreaId), true)}" var="document">
	<li class="add">
	<label for="documentIds" style="min-width:120px">
		${document.number}
	</label>
	<g:checkBox name="documentIds" value="${document.id}" checked="false" />
	</li>
</g:each>
</ul>

</div>

